package com.ken.zeratul.auto.config.i18n;

import com.ken.zeratul.i18n.config.I18nConfiguration;
import com.ken.zeratul.i18n.config.LocaleResolverConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class I18nAutoConfiguration {

    @Bean
    @ConditionalOnBean(type = "com.alibaba.cloud.nacos.NacosConfigManager")
    public I18nConfiguration getConfiguration() {
        return new I18nConfiguration();
    }

    @Bean
    @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
    public LocaleResolverConfiguration getLocaleResolverConfiguration() {
        return new LocaleResolverConfiguration();
    }
}
